package com.ty.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ty.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface OrderDetailMapper extends BaseMapper<OrderDetail>  {

    /**
     * 保存订单详情
     *
     * @param orderDetail
     * @return
     */
    int insert(@Param("orderdetail")OrderDetail orderDetail );

    /**
     * 更新订单详情
     *
     * @param orderDetail
     * @return
     */
    int update(@Param("orderdetail")OrderDetail orderDetail);

    /**
     * 删除订单详情
     * @param orderDetailId
     */
    void deleteByOrderId(@Param("orderDetailId") Integer orderDetailId);

    /**
     * 批量保存订单详情
     *
     * @param orderDetails
     * @return
     */
    int saveBatch(@Param("orderDetails")OrderDetail orderDetails );

    /**
     * 根据订单获取订单详情
     * @param orderId
     * @return
     */
    List<OrderDetail> queryByOrderId(@Param("orderId") Integer orderId);



}
